<template>
  <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" append-to-body v-dialogDrag width="90%">
    <div class="shadow" style="margin: 15px;border-radius: 5px;background: #fff;padding: 15px;">

      <div style="margin-bottom: 10px;">
        <el-button size="mini" icon="el-icon-warning" :plain="testType === 'surface'"
                   @click="onButtonTestType('surface')">外观检查
        </el-button>
        <el-button size="mini" icon="el-icon-warning" :plain="testType === 'size'"
                   @click="onButtonTestType('size')">尺寸检查
        </el-button>
      </div>
      <factory-goods-test-surface-list v-if="testType==='surface'" :workOrderId="workOrderId" :goodsId="goodsId" :editFlag="editFlag"
                                       :reportWorkId="reportWorkId" :rukuId="rukuId" :goodsSaleId="goodsSaleId"></factory-goods-test-surface-list>
      <factory-goods-test-size-list v-if="testType==='size'" :workOrderId="workOrderId" :goodsId="goodsId" :editFlag="editFlag"
                                    :reportWorkId="reportWorkId" :rukuId="rukuId" :goodsSaleId="goodsSaleId"></factory-goods-test-size-list>
    </div>
  </el-dialog>
</template>

<script>
import {deleteAction, getAction} from '@/api/manage'
import FactoryGoodsTestSizeList from "@/views/develop/factory/factoryTestSize/FactoryGoodsTestSizeList.vue";
import FactoryGoodsTestSurfaceList from "@/views/develop/factory/factoryTestSurface/FactoryGoodsTestSurfaceList.vue";

export default {
  name: "FactoryTestQualityProcess",
  components: {
    FactoryGoodsTestSurfaceList,
    FactoryGoodsTestSizeList,
  },
  data() {
    return {
      // 遮罩层
      loading: true,
      activeName: "first",
      // 弹出层标题
      title: "生产过程质检",
      // 是否显示弹出层
      open: false,
      // 显示搜索条件
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 出厂试验-镀锌质量表格数据
      dataList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        projectId: null,
        orderId: null,
        goodsId: null,
        goodsName: null,
        goodsModel: null,
        batchNumber: null,
        productNumber: null,
        inspectTime: null,
        znThick: null,
      },
      url: {
      },
      tableMaxHeight: window.innerHeight - 320,
      isButton: 1,
      isIndex: 0,
      total1: 0,
      loading1: true,
      activeName1: '1',
      dataList1: [],
      testType: 'surface',
      workOrderId: null,
      workOrder: {},
      workOrderCode: null,
      goodsId: null,
      goodsSaleId: null,
      daohuoDetailId: null,
      rukuId: null,
      typeName:null,
      goodsName:null,
      factoryGoodssaleId:null,
      editFlag:false,
      reportWorkId:null,
    };
  },
  created() {
    window.addEventListener('resize', this.getTableHeight);
  },
  destroyed() {
    window.removeEventListener('resize', this.getTableHeight)
  },
  methods: {
    getTableHeight() {
      this.tableHeight = window.innerHeight - 320
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },

    // 根据工序质检
    showByProcess(reportWork,editFlag) {
      this.reportWorkId = reportWork.id;
      this.editFlag = true;
      this.open = true;
    },

    onIndex(e) {
      this.isIndex = e
    },
    onButtonTestType(type) {
      this.testType = type;
    },
    onButtons(e) {
      this.isButton = e;
    },

  }
};
</script>
<style scoped lang="scss">


</style>
